<template>
  <div class="user_info_card" :style="{ '--background-image': `url('${imageSrc}')` }">
    <div class="user_avatar" />
    <div class="user_text">
      <h3>{{ nickname }}</h3>
      <h4>{{ description }}</h4>
    </div>
    <i class="ri-logout-box-r-line logout" @click="logout"></i>
    <small># {{ uid }}</small>
  </div>
</template>

<script>
export default {
  name: "UserInfoCard",
  props: {
    uid: String | Number,
    nickname: String,
    description: String,
    imageSrc: {
      type: String,
      default: "/webp_よろしく令和！_74502133.webp"
    },
    logout: Function
  }
}
</script>

<style scoped lang="less">
.user_info_card {
  --background-image: null;
  --avatar-size: 75px;

  gap: 30px;
  padding: 25px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  background-color: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  position: relative;
  border-radius: 10px;

  text-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  background-image: var(--background-image);

  &::before {
    content: "";
    width: 100%;
    height: 100%;
    position: absolute;
    -webkit-backdrop-filter: blur(50px);
    backdrop-filter: blur(50px);
  }

  & > .user_avatar {
    position: relative;
    flex-shrink: 0;

    height: var(--avatar-size);
    width: var(--avatar-size);
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-image: var(--background-image);
    outline: 5px solid rgba(255, 255, 255, 0.3);
  }

  & > .user_text {
    position: relative;
    display: flex;
    flex-grow: 1;
    gap: 10px;

    align-items: flex-start;
    justify-content: center;
    flex-direction: column;
  }

  & > small {
    position: absolute;
    bottom: 10px;
    right: 20px;
    font-weight: 900;
  }
}
.logout {
  position: absolute !important;
  top: 20px;
  right: 22px;
  font-size: 20px;
  cursor: pointer;
}
</style>